<?= \common\widgets\Asset::widget(['type'=>['star']])?>
    <style>
        legend {
            width: auto !important;
            border-style: none !important;
        }
        body{
            font-size: initial;
        }
        .xzw_starSys .current-rating{
            position: inherit;
        }
        .xzw_starSys {
            padding: inherit;
            margin: auto;
        }
    </style>
    <div class="layui-card-body">
        <!--基本信息-->
        <div class="layui-form" lay-filter="layuiadmin-form-order" id="layuiadmin-form-order">
            <input type="hidden" class="order_id" name="order_id" value="17">

            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>订单信息</legend>
                </fieldset>
            </div>

            <div class="layui-form-item div-flex">
                <div class="row row-no-gutters">
                    <div class="col-xs-4">订单编号：<?= $data['order_sn'] ?></div>
                    <div class="col-xs-4">下单时间：<?= $data['create_time'] ?></div>
                </div>
            </div>
            <div class="layui-form-item div-flex">
                <div class="row row-no-gutters">
                    <div class="col-xs-4">支付时间：<?= $data['pay_time'] ?></div>
                    <div class="col-xs-4">支付状态：<?= $pay_status[$data['pay_status']]??'' ?></div>
                    <div class="col-xs-4">订单状态：<?= $order_status[$data['order_status']]??'' ?></div>
                </div>
            </div>

            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>会员信息</legend>
                </fieldset>
            </div>
            <div class="layui-form-item div-flex">
                <div class="row row-no-gutters">
                    <div class="col-xs-4">会员编号：<?= $user['id']??'' ?></div>
                    <div class="col-xs-4">会员昵称：<?= $user['nickname']??'' ?></div>
                    <div class="col-xs-4">头像：<img src="<?= $user['avatar']??''?>" alt=""></div>
                </div>
                <div class="row row-no-gutters">
                    <div class="col-xs-4">注册时间：<?= $user['create_time']??'' ?></div>
                </div>
            </div>
            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>收货信息</legend>
                </fieldset>
            </div>
            <div class="layui-form-item div-flex">
                <div class="row row-no-gutters">
                    <div class="col-xs-4">收货人：<?= $data['consignee'] ?></div>
                    <div class="col-xs-4">手机号：<?= $data['mobile'] ?></div>
                    <div class="col-xs-4">收货地址：<?= $data['province'].$data['city'].$data['district'].$data['address'] ?></div>
                </div>
            </div>
            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>商品信息</legend>
                </fieldset>
            </div>

            <div class="layui-form-item table-margin">
                <table class="layui-table">

                    <thead>
                    <tr>
                        <th>商品订单编号</th>
                        <th>商品信息</th>
                        <th>价格(元)</th>
                        <th>数量</th>
                        <th>小计(元)</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach ($data['goods'] as $good):?>
                    <tr>
                        <td><?=$good['good_id']?></td>
                        <td>
                            <div style="text-align: left">
                                <div class="layui-col-md5">
                                    <img src="<?=$good['good_info_arr']['main_img']?>" class="image-show image">
                                </div>
                                <div class="layui-col-md5">
                                    <p style="margin-top: 10px"><?=$good['good_name']?></p>
                                    <br>
                                    <p><?=$good['spec_name']?></p>
                                </div>
                            </div>
                        </td>
                        <td>￥<?=$good['good_price']?></td>
                        <td><?=$good['good_num']?></td>
                        <td><?=$good['good_price']?></td>
                    </tr>
                    <?php endforeach;?>
                    <tr>
                        <td colspan="4"></td>
                        <td style="text-align: left">
                            <p>商品金额:￥<?=$data['total_amount']?></p>
                            <p>运费金额:￥<?=$data['freight']?></p>
                            <p style="color: red">优惠金额:￥<?=$data['discount_amount']?></p>
                            <p>应付金额:￥<?=$data['pay_amount']?></p>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>买家留言</legend>
                </fieldset>
            </div>
            <div class="layui-form-item table-margin">
                <textarea class="layui-textarea" disabled=""><?=$data['user_remark']?></textarea>
            </div>
            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>订单操作</legend>
                </fieldset>
            </div>

            <div class="layui-form-item div-flex ">
                <div class="layui-input-block ">
                    <?php if ($data['order_status']==1):?>
                        <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="deliver('<?=$data['id']?>')">发货</button>
                    <?php endif;?>
                </div>
            </div>
            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>订单评论</legend>
                </fieldset>
            </div>
            <div class="layui-form-item div-flex ">
                <div class="layui-input-block" style="width: 50%">
                    <?php foreach ($orderCommrnt as $item):?>
                        <div style="display: flex;justify-content: space-between;">
                            <div style="display: flex;width: 90%;">
                                <div><img class="img-circle" width="80px" src="<?=$item['avatar']?>" alt=""></div>
                                <div style="margin-left: 20px;width: 50%;">
                                    <div><?=$item['nickname']?></div>
                                    <div>
                                        <div class="xzw_starSys">
                                            <div class="xzw_starBox">
                                                <div class="current-rating showb" data-value="<?=$item['star']?>"></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div><?=$item['content']?></div>
                                </div>
                            </div>

                            <div>
                                <div><?=date('m月d日',strtotime($item['create_time']))?></div>
                            </div>
                        </div>
                        <hr>
                    <?php endforeach;?>
                </div>
            </div>
            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>订单日志</legend>
                </fieldset>
            </div>

            <div class="layui-form-item table-margin">
                <table class="layui-table">
                    <colgroup>
                        <col width="100">
                        <col width="100">
                        <col width="250">
                    </colgroup>
                    <thead>
                    <tr>
                        <th>日期</th>
                        <th>动作类型</th>
                        <th>日志内容</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach ($log as $it):?>
                    <tr>
                        <td><?=$it['create_time']?></td>
                        <td><?=$it['action']?></td>
                        <td><?=$it['content']?></td>
                    </tr>
                    <?php endforeach;?>
                    </tbody>
                </table>
            </div>


        </div>
    </div>
    <script>
        <?php $this->beginBlock('js_end')?>
            function deliver(id) {
                $.modal.open("发货", '<?=\yii\helpers\Url::to(['deliver'])?>?id='+id,'80','80',null,'%');
            }
        <?php $this->endBlock()?>
    </script>
<?php $this->registerJs($this->blocks['js_end'], \yii\web\View::POS_END); ?>